<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<title>{$school['title']}</title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width initial-scale=1.0 maximum-scale=1.0 user-scalable=yes" />
<link type="text/css" rel="stylesheet" href="{OSSURL}public/mobile/css/mGrzxTeacher.css?v=4.80915" />
<link type="text/css" rel="stylesheet" href="{OSSURL}public/mobile/css/greenStyle.css?v=4.80120" />
<script type="text/javascript" src="{MODULE_URL}public/mobile/js/jquery-1.11.3.min.js?v=4.8"></script>
<script type="text/javascript" src="{OSSURL}public/mobile/js/PromptBoxUtil.js?v=4.81022"></script>
{php include $this->template('port');}
</head>
<body>		
<div id="BlackBg" class="BlackBg"></div>
<div id="titlebar" class="header mainColor">
	<div class="l"><a class="backOff" style="background:url({OSSURL}public/mobile/img/ic_arrow_left_48px_white.svg) no-repeat;background-size: 55% 55%;background-position: 50%;" href="javascript:history.go(-1);"></a></div>
	<div class="m">
		<span style="font-size: 18px">教师中心</span>   
	</div>
	<div class="r">
		<a href="javascript:location.replace(location.href); "></a>
	</div>
</div>
<div id="titlebar_bg" class="_header"></div>
		<div class="stuBanner">
			<div class="stuBannerBg">
			</div>
		</div>
		<div class="stuBox">
			<div class="stuInfo">
				<input type="hidden" id="bigImage" name="bigImage"/>
				<div class="stuHeader" onclick="uploadImg(this);">
					<img alt="头像" src="{if !empty($teacher['thumb'])}{php echo tomedia($teacher['thumb'])}{else}{php echo tomedia($school['tpic'])}{/if}" />
					<label style="text-align: center;font-size: 10px;display: block;color: #999; margin-top: -5px;">点击修改</label>
				</div>
				<div class="stuInfoCenter">
					<div class="stuName">
						<label class="m_r_10">{$teacher['tname']}</label>
					</div>
					<div class="stuCampusAndBjname">
						<span class="campus">{if $teacher['status'] == 1}老师{else if $teacher['status'] == 2}校长{/if}</span>
						<span id="teacher_mobile" class="bjname">{if !empty($bzj)}{$bzj['sname']}班主任{else}科任老师{/if}{if !empty($njzr)}&nbsp;年级主任{/if}</span>
					</div>
				</div>	
			</div>					
			<div class="stuServer">
				<label>服务</label>
				<div class="server">
					<span>已绑定</span>
				</div>
				<div id="jiebang1" class="unbound">解绑</div>
			</div>
			<div class="stuServer">
				<label>考勤</label>
				<div class="server">
					<span>请假</span>
				</div>
				<div onclick="qingjia();" class="unbound">请假</div>
			</div>
			<div class="stuServer" style="height:auto;">
				<label style="height:auto;">班级</label>
				<div class="server" style="height:auto;">
					<span>{if !empty($bj1['sname']) || !empty($bj1['sname']) || !empty($bj1['sname'])}丨{$bj1['sname']}丨{$bj2['sname']}丨{$bj3['sname']}{else}无授课班级{/if}</span>
				</div>
			</div>
		</div>
		<div class="user_info" id="user_info" style="display:none;">
			<div>
                <ul>
					<p style="font-size:20px;color:#fe6700;">一键放学</p>
						{if !empty($bzj)}
						<div class="stuServer">
							<label>班主任</label>
							<select id="bjid">
								<option value="">请选择</option>
							{loop $bjlist $row}
								<option value="{$row['sid']}">{$row['sname']}</option>
							{/loop}	
							</select>
						</div>
						{else}
						<div class="stuServer">
							<label>班级</label>
							<div class="server">
								<span>你不是班主任</span>
							</div>
						</div>						
						{/if}
						</br>
                        <p style="font-size:15px;color:red;">注意：请勿重复操作！</p>
                        </br>
                        {if !empty($bzj)}						
                        <div class="sendBtn  f15 db c2" id="btn">放学</div>
						{/if}
						<div class="sendBtn cancelNewBtn f15 db c2" id="close">取消</div>		
                </ul>				
			</div>
        </div>
		<div class="linkDiv" style="margin-top:10px;">		
			<a href="{php echo $this->createMobileUrl('tlylist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_msg.png" style="width:35px;">
					</div>
					<span class="linkName">留言</span>
				</div>
			</a>
			<a href="{php echo $this->createMobileUrl('noticelist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_bjtz.png" style="width:35px;">
					</div>			
					<span class="linkName">班级通知</span>	
				</div>
			</a>
			{if !empty($bzj)}
			<a href="{php echo $this->createMobileUrl('smssage', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_ktdt.png" style="width:35px;">
					</div>			
					<span class="linkName">学生请假</span>	
				</div>
			</a>
			{/if}	
            {if $teacher['status'] == 2}
			<a href="{php echo $this->createMobileUrl('tmssage', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_yezs.png" style="width:35px;">
					</div>
					<span class="linkName">职工请假</span>
				</div>
			</a>			
			<a href="{php echo $this->createMobileUrl('mnoticelist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_alarm.png" style="width:35px;">
					</div>			
					<span class="linkName">校园群发</span>	
				</div>
			</a>
			{else}
			<a href="{php echo $this->createMobileUrl('mnoticelist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_alarm.png" style="width:35px;">
					</div>			
					<span class="linkName">校园公告</span>	
				</div>
			</a>			
			{/if}
			<a href="{php echo $this->createMobileUrl('zuoyelist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_zuoye.png" style="width:35px;">
					</div>			
					<span class="linkName">发布作业</span>	
				</div>
			</a>
			<a href="#" id="scroll">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_fx.png" style="width:35px;">
					</div>			
					<span class="linkName">一键放学</span>	
				</div>
			</a>
			<a href="{php echo $this->createMobileUrl('bjq', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_bjq.png" style="width:35px;">
					</div>			
					<span class="linkName">班级圈</span>	
				</div>
			</a>
			<a href="{php echo $this->createMobileUrl('xclist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_xc.png" style="width:35px;">
					</div>			
					<span class="linkName">班级相册</span>	
				</div>
			</a>
			<a href="{php echo $this->createMobileUrl('bmlist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_bm.png" style="width:35px;">
					</div>			
					<span class="linkName">报名列表</span>	
				</div>
			</a>
			{if !empty($bzj)}
			<a href="{php echo $this->createMobileUrl('signlist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_sck.png" style="width:35px;">
					</div>			
					<span class="linkName">学生考勤</span>	
				</div>
			</a>
			{/if}
			{if $teacher['status'] == 2 || !empty($njzr)}
			<a href="{php echo $this->createMobileUrl('jschecklog', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_jskq.png" style="width:35px;">
					</div>			
					<span class="linkName">职工考勤</span>	
				</div>
			</a>
			{/if}
			<a href="{php echo $this->createMobileUrl('tongxunlu', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/ioc11.png" style="width:35px;">
					</div>			
					<span class="linkName">通讯录</span>	
				</div>
			</a>
			{if !empty($bzj)}
			{if $school['is_zjh'] ==1}
			<a href="{php echo $this->createMobileUrl('tzjhlist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_zjh.png" style="width:35px;">
					</div>			
					<span class="linkName">周计划</span>	
				</div>
			</a>
			{/if}
			{/if}
			{if $school['is_rest'] ==1}
			<a href="{php echo $this->createMobileUrl('shoucelist', array('schoolid' => $schoolid), true)}">
				<div class="linkBox">
					<div class="linkImg">
						<img alt="" src="{OSSURL}public/mobile/img/link_zxbx.png" style="width:35px;">
					</div>			
					<span class="linkName">{$school['shoucename']}</span>	
				</div>
			</a>
			{/if}		
			<div class="cl"></div>
		</div>
{php include $this->template('comad');}
</body>
<script type="text/javascript">
var PB = new PromptBox();
function qingjia(){
    window.location.href = "{php echo $this->createMobileUrl('qingjia', array('schoolid' => $schoolid), true)}"
}

$(function ($) {
		//弹出
	$("#scroll").on('click', function () {
		$('#user_info').show();
	});
	$("#close").on('click', function () {
		$('#user_info').hide();
	});
	//文本框不允许为空---按钮触发
	$("#btn").on('click', function () {
		var bjid = $('#bjid').val();
		if (bjid == '') {
			jTips('请选择发送班级！');
			return false;
		}
		 submitData = {
		 openid :"{$openid}",
		 schoolid:"{$schoolid}",
		 weid :"{$weid}",
		 tname:"{$teacher['tname']}",
		 bj_id:$("#bjid").val(),
		}
		jConfirm("确认要发送吗?", "删除确定对话框", function (isConfirm) {
		PB.prompt("放学信息群发中~","forever");
			if (isConfirm) {
			$.post("{php echo $this->createMobileUrl('dongtaiajax',array('op'=>'fangxue'))}",submitData,
				function(data){
					if(data.result){
						PB.prompt(data.msg);
						location.reload();
					}else{
						PB.prompt(data.msg);
					}
				},'json');	
			} else $('#user_info').hide();
		});		
	});	
});

var images = {
	    localId: [],
	    serverId: []
};

function uploadImg(){

	wxChooseImage();
}

/**
 * 微信选择图片
 */
function wxChooseImage(){
	wx.chooseImage({
		success: function (res) {
			images.localId = res.localIds;
			var obj=new Image();
			obj.src=res.localIds[0];
			imagesUploadWx();
		}
	});
};

function imagesUploadWx() {
	      wx.uploadImage({
	        localId: images.localId[0],
	        isShowProgressTips:1,//// 默认为1，显示进度提示
	        success: function (res) {
	        	$("#bigImage").val(res.serverId);
				saveImage();
	        },
	        fail: function (res) {
	          alert(JSON.stringify(res));
	        }
	      });
};

$("#jiebang1").on('click', function () {
	jConfirm("解绑后数据将丢失,确认要解绑吗？", "删除确定对话框", function (isConfirm) {
		if(isConfirm){
			var submitData = {
				openid :"{$teacher['openid']}",
				schoolid :"{$schoolid}",
				weid :"{$weid}",
				tid :"{$teacher['id']}",
				user :"{$it['id']}",
			};
				$.post("{php echo $this->createMobileUrl('indexajax',array('op'=>'unboundls'))}",submitData,function(data){
				if(data.result){
					PB.prompt(data.msg);
					window.location.href = "{php echo $this->createMobileUrl('bangding', array('schoolid' => $schoolid), true)}"
				}else{
					PB.prompt(data.msg);
				}
			},'json'); 
		}
	});		
});

function saveImage() {
	PB.prompt("头像上传中，请稍等~","forever");
	var url = "{php echo $this->createMobileUrl('indexajax',array('op'=>'changeimgt'))}";
	var submitData = {
			bigImage:$("#bigImage").val(),
			tid:"{$it['tid']}",
	};
	$.post(url, submitData, function(data) {
		if (data.result) {
			jTips(data.msg);
			location.reload();
		} else {
			jTips(data.msg);
		}
	},'json');
}
</script>
{php include $this->template('newfooter');}
</html>